import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
  ManyToOne,
  JoinColumn,
} from 'typeorm';
import { CustomerServiceGroup } from './group.entity';

@Entity('customer_service_agent')
export class CustomerServiceAgent {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  username: string;

  @Column()
  name: string;

  @Column({ default: true })
  isActive: boolean;

  @ManyToOne(() => CustomerServiceGroup, { nullable: true })
  @JoinColumn({ name: 'groupId' })
  group: CustomerServiceGroup;

  @Column({ default: 'agent' })
  role: 'agent' | 'supervisor';

  @Column({ default: 5 })
  maxConcurrentSessions: number;

  @Column({ default: false })
  isOnline: boolean;

  @Column()
  password: string;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 